import javax.swing.SwingUtilities;

/**
 * Main class, hold the entry point and the entry argument management. 
 *
 */
public class Faces {

	public static void main(String[] args) {
		if (args.length < 3) {
			printUsage();
			System.exit(0);
		}
		NeuronNetwork.learn(args[0], args[1]);
		NeuronNetwork.detect(args[2]);
	}

	public static void printUsage() {
		System.out.println("Usage :\nFaces <Training image file> <Training answer file> <Test file>");
	}
	
	/**
	 * Static function mainly used for debug purpose showing the given image in a window
	 */
	public static void showImage(final Image i) {
		SwingUtilities.invokeLater(new Runnable(){
			public void run(){
				// New JDialog
				ImageViewer window = new ImageViewer(i.getMatrix(), i.getName());
				window.setVisible(true); // Make it visible
				window.repaint();
			}
		});
	}
		
}
